<?php

namespace app\shadmin\controller;


use think\Db;
use think\Request;


class Sales extends \think\Controller
{
    public function _initialize()
    {
        // parent::_initialize();
        if (!session('?aid')) {

            $this->redirect('shadmin/login/index');


        }

        if(session('status')!=="运营部" && session('status')!="管理员"){

         

          $this->redirect('shadmin/login/noacc');
       die;
         

        }


    }


    public function index(){
         
      
      

        $list=Db::table('news_cate')->where("Level",1)->select();
        $this->assign('catelist',$list);

        return view();
    }

    public function main(){
/*
        $all['news_num']=Db::table('news')->count();
        $all['news_num_click']=Db::table('news')->sum('PageNum');
        $all['pro_num']=Db::table('product')->where(['ShopType'=>1])->count();
        $all['pro_num_click']=Db::table('product')->where(['ShopType'=>1])->sum('PageNum');

        $all['sq_pro_num']=Db::table('product')->where(['ShopType'=>2])->count();
        $all['sq_pro_num_click']=Db::table('product')->where(['ShopType'=>2])->sum('PageNum');

        $all['sj_num']=Db::table('product_business')->where(['ShopType'=>1])->count();
        $all['sq_num']=Db::table('product_business')->where(['ShopType'=>2])->count();
        $this->assign('all',$all);

*/


     $all['usernum']=Db::table('user')->where(['addtime'=>['gt',date('Y-m-d 00:00:01')]])->count();
     $all['newsnum']=Db::table('news')->where(['addtime'=>['gt',date('Y-m-d 00:00:01')]])->count();
     $all['newsnum4']=Db::table('news')->where(['State'=>['neq',4]])->count();


       $this->assign('all',$all);
        return view();
    }


}